print 'tables consuming most storage space as of ' + convert(varchar,getdate(),1) select case grouping(i.id) when (0) then cast(object_name(i.id) as varchar(40)) else 'TOTAL' end [Table] , case grouping(i.id) when (1) then '' else cast(sum(i.rowcnt) as varchar(18)) end [row count] , sum((cast(f.BestCount as bigint) * 8 * 8192) + (cast(f.BestCount as bigint) * 8 * 8192)/10) [est storage space used] from sysindexes i join admin.dbo.fraglist f on object_name(i.id) = f.ObjectName and i.indid = f.indexid where i.indid = 1 and i.id > 100 and f.status < 10 and i.rowcnt > 10000 group by i.id with rollup order by sum((cast(f.BestCount as bigint) * 8 * 8192) + (cast(f.BestCount as bigint) * 8 * 8192)/12) desc